<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
    <h:head>
        <title><ui:insert name="title"></ui:insert></title>
        <ui:insert name="header">
            <ui:include src="header.xhtml"/>
            <ui:include src="sessionTimeOut.xhtml"/>
        </ui:insert>
        <script type="text/javascript">
            function textObjectUpperCase(textObject) {
                textObject.value = textObject.value.toUpperCase() ;
            }

            function upperInput() {
                jQuery("input[type='text']").blur(function(){
                    var input= jQuery(this);
                    input.attr("value",input.attr("value").toUpperCase());
                })
            }
            function validarInit() {
                upperInput();
                if (jQuery.isFunction(window.initForm)) {
                    initForm();
                }


            }

        </script>
    </h:head>
    <h:body onload="validarInit();">
        <p:growl id="messages" widgetVar="wMessages" showDetail="true"
                 life="10000" sticky="false" autoUpdate="false" globalOnly="true">
        </p:growl>

        <h:panelGrid cellspacing="0" cellpadding="0" styleClass="centered">
            <h:panelGrid columns="1" style="width:100%;">
                <h:form>
                    <h:panelGroup styleClass="centered">
                        <h:panelGrid columns="2" style="width: 100%;" styleClass="centered">
                            <p:spacer width="150" height="80"/>
                            <h:panelGroup styleClass="header_welcome ui-toolbar-group-rigth">
                                <h:outputText value="#{messages.label_welcome} #{menuBean.usuario.nombreCompleto} | "
                                        />
                                <h:outputLink styleClass="text_title"
                                              value="#{facesContext.externalContext.requestContextPath}/j_spring_security_logout"
                                              icon="ui-icon-close"
                                        >
                                    <h:outputText escape="false" styleClass="text_title"
                                                  value="#{messages.label_logout}"/>
                                </h:outputLink>
                            </h:panelGroup>

                        </h:panelGrid>
                    </h:panelGroup>
                    <h:panelGrid columns="3" width="100%">

                        <p:menubar styleClass="centered" rendered="#{menuBean.mostrarMenu}">
                            <p:menuitem id="mainx" value="#{messages.label_menuOpcionesInicio}"
                                        actionListener="#{menuBean.pageAction}">
                                <f:attribute name="page" value="main.jsf"/>
                            </p:menuitem>
                            <p:submenu label="#{messages.label_menuOpcionesReporte}" icon="ui-icon-document">
                                <c:forEach items="#{menuBean.reportesContables}" var="opcion">
                                    <p:menuitem id="#{opcion.id}" value="#{opcion.descripcion}"
                                                actionListener="#{menuBean.pageAction}">
                                        <f:attribute name="page" value="#{opcion.url}"/>
                                    </p:menuitem>
                                    <p:separator/>
                                </c:forEach>
                            </p:submenu>
                            <p:submenu label="#{messages.label_menuOpcionesReporteGeneral}" icon="ui-icon-document">
                                <c:forEach items="#{menuBean.reportesGenerales}" var="opcion">
                                    <p:menuitem id="#{opcion.id}" value="#{opcion.descripcion}"
                                                actionListener="#{menuBean.pageAction}">
                                        <f:attribute name="page" value="#{opcion.url}"/>
                                    </p:menuitem>
                                    <p:separator/>
                                </c:forEach>
                            </p:submenu>
                            <p:submenu label="#{messages.label_menuOpcionesMaestrosContables}" icon="ui-icon-document">
                                <c:forEach items="#{menuBean.maestrosContables}" var="opcion">
                                    <p:menuitem id="#{opcion.id}" value="#{opcion.descripcion}"
                                                actionListener="#{menuBean.pageAction}">
                                        <f:attribute name="page" value="#{opcion.url}"/>
                                    </p:menuitem>
                                    <p:separator/>
                                </c:forEach>
                            </p:submenu>
                            <p:submenu label="#{messages.label_menuOpcionesMaestros}" icon="ui-icon-document">
                                <c:forEach items="#{menuBean.maestrosPriox}" var="opcion">
                                    <p:menuitem id="#{opcion.id}" value="#{opcion.descripcion}"
                                                actionListener="#{menuBean.pageAction}">
                                        <f:attribute name="page" value="#{opcion.url}"/>
                                    </p:menuitem>
                                    <p:separator/>
                                </c:forEach>
                            </p:submenu>
                            <p:submenu label="#{messages.label_menuOpcionesMaestrosSigar}" icon="ui-icon-document">
                                <c:forEach items="#{menuBean.maestrosSigar}" var="opcion">
                                    <p:menuitem id="#{opcion.id}" value="#{opcion.descripcion}"
                                                actionListener="#{menuBean.pageAction}">
                                        <f:attribute name="page" value="#{opcion.url}"/>
                                    </p:menuitem>
                                    <p:separator/>
                                </c:forEach>
                            </p:submenu>
                        </p:menubar>
                    </h:panelGrid>
                </h:form>
            </h:panelGrid>
            <h:panelGrid cellspacing="0" width="100%" cellpadding="0" styleClass="content centered">
                <h:panelGroup>
                    <h:panelGrid cellspacing="0" cellpadding="0" styleClass="content"  width="100%">
                        <ui:insert name="content"/>
                        <p:ajaxStatus onstart="wvStatusDialog.show();" onsuccess="wvStatusDialog.hide();"/>

                        <p:dialog modal="true" id="statusDialog" widgetVar="wvStatusDialog" showHeader="false"
                                  resizable="false" draggable="false" closable="false" position="center"
                                  appendToBody="true">
                            <p:graphicImage value="../resources/images/ajaxloadingbar.gif"/>
                        </p:dialog>
                    </h:panelGrid>
                    <ui:insert name="footer">
                        <!--ui:include src="footer.xhtml"/-->
                    </ui:insert>
                </h:panelGroup>
            </h:panelGrid>
        </h:panelGrid>
        <ui:insert name="modal"/>
    </h:body>
</f:view>
</html>